import com.ktjy.cn.paper.TextPaper;
import com.ktjy.cn.printer.Printer;
import com.ktjy.entity.Employee;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Employee employee = (Employee) context.getBean("emp1");
        employee.show();

        Employee employee2 = (Employee) context.getBean("emp2");
        employee2.show();

        //sz2
        TextPaper textPaper = (TextPaper) context.getBean("textPaper");
        Printer printer = (Printer) context.getBean("sz2_1");
        printer.print(textPaper.getContent());

        Printer printer2 = (Printer) context.getBean("sz2_2");
        printer2.print(textPaper.getContent());

        //sz3
        Printer p = (Printer) context.getBean("sz3_1");
        p.print(textPaper.getContent());

        Printer p2 = (Printer) context.getBean("sz3_2");
        p2.print(textPaper.getContent());
        //sz4
        Employee employee3 = (Employee) context.getBean("sz4_1");
        employee3.show();
        Employee employee4 = (Employee) context.getBean("sz4_2");
        employee4.show();
    }
    @Test
    public void test() {
        //sz5
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        Printer printer = (Printer) context.getBean("printer");
        printer.print("");
    }
}
